from PIL import Image  # 导入Image类
from torchvision import transforms  # 导入transforms模块
imgOriginal = Image.open('1.png') # 打开图片
imgOriginal.show()

imgResize = transforms.Resize((300, 600))(imgOriginal)  # 进行比例缩放
print(f'{imgOriginal.size}---->{imgResize.size}')   # 输出图像缩放前后的大小
imgResize.show()
